#include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include "Poisson.h"

using namespace std;

double u(const Point<2, double> &p)
{
	return sin(p[0]) * sin(p[1]);
}

double f(const Point<2, double> &p)
{
	return 2 * sin(p[0]) * sin(p[1]);
}

ostream& operator<<(ostream& os, const valarray<double>& v)
{
	os << fixed << setprecision(3);
	os << "(";
	for (size_t i = 0; i < v.size() - 1; ++i) {
		os << v[i] << ", ";
		if (i % 10 == 0 && i > 0)
			os << std::endl;
	}
	os << v[v.size() - 1] << ")";

	return os;
}

double MaxNorm(const Vector& v)
{
	double max = 0, tmp = 0;
	for (size_t i = 0; i < v.rows(); ++i) {
		tmp = fabs(v[i]);
		if (tmp > max)
			max = tmp;
	}
	return max;
}
